import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Main extends JFrame implements ActionListener {
    JTextArea ta;
    JTextField t;
    JButton b;

    Main(){
        setSize(400,250);
        setLayout(new FlowLayout());
        Container c = getContentPane();
        setVisible(true);
        ta = new JTextArea(5,10);
        ta.setLineWrap(true);
        JScrollPane sp = new JScrollPane(ta);
        sp.setBorder(BorderFactory.createLoweredBevelBorder());
        c.add(sp);
        t = new JTextField(10);
        b = new JButton("提交");
        b.addActionListener(this);
        c.add(b);
        c.add(t);
        pack();
        setVisible(true);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
    public static void main(String[] args) {
        new Main();
    }

    @Override
    public void actionPerformed(ActionEvent e){
        if(e.getSource() == b){
            ta.setText(t.getText());
        }
    }
}